package com.aijk.ehm.utils;

/**
 * Created by Ricky on 2015/8/1.
 */
public class ModUtils {
    public static String getMod10(String number){
        int check = 10, check_in;
        String str;
        for(int i = 0; i< number.length(); i++){
            str = number.substring(i, i + 1);
            check_in = (Integer.parseInt(str) + check) % 10;
            check_in = check_in == 0 ? 10 : check_in;
            check = (check_in * 2) % 11;
        }

        check = 11 - check;
        check = check == 10 ? 0 : check;

        return number + String.valueOf(check);
    }
}
